package com.java.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.aliyun.oss.OSSClient;

/**
 * AliConfiguration
 * <p></p>
 *
 * @author Vigor Yuan
 */
@Configuration
public class AliConfiguration {

    /**
     * 阿里云 OSS 服务OSSClient
     *
     * @param accessId
     * @param accessKey
     * @param accountEndpoint
     * @return
     */
    @Bean
    public OSSClient ossClient(@Value("${sys.aliyun.oss.accessKeyId}") String accessId,
                               @Value("${sys.aliyun.oss.accessKeySecret}") String accessKey,
                               @Value("${sys.aliyun.oss.endpoint}") String accountEndpoint) {
        return new OSSClient(accountEndpoint, accessId, accessKey);
    }
}
